package com.clstu.leetcode;

import java.util.ArrayList;
import java.util.List;

/**
 * 汉诺塔问题
 */
public class Solution4 {

    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(56);
        System.out.println(list.remove(0));//list.remove()返回的是被删除的值
        hnt(2,"A","B","C");
    }
    public void hanota(List<Integer> from, List<Integer> helper, List<Integer> to) {

    }

    //普通的汉诺塔问题(将n个盘,从from移动到to,借助helper
    public static void hnt(int n,String from ,String helper,String to){
        //如果只有一个盘
        if(n == 1){
            System.out.println("盘 1:"+from+"--------->"+to);
            return;
        }
        //否则,先将上面的n-1个盘移动到helper,...
        hnt(n-1,from,to,helper);
        System.out.println("盘 "+n+from+"---------->"+to);
        hnt(n-1,helper,from,to);
    }
}
